package com.leyou.item.dao;


import com.leyou.item.pojo.Brand;
import com.leyou.item.pojo.Category;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author:yanjizhw@163.com
 * @date:2019-09-25 14:30
 * 描述:
 * @since:1.0.0
 */

public interface BrandMapper extends Mapper<Brand> {

    @Insert("insert into tb_category_brand (category_id, brand_id) values (#{cid}, #{bid})")
    int insertCategoryBrand(@Param("cid") Integer cid, @Param("bid") Integer bid);

    List<Category> selectCategoryIdByBrandId(Integer bid);

    @Update("update tb_category_brand set category_id = cid where brand_id = bid ")
    int updateMiddleCidByBid(@Param("cid") Integer cid, @Param("bid") Integer bid);

    @Delete("delete from tb_category_brand where brand_id = bid")
    int deleteMiddleByBid(Integer bid);
}
